<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">

<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />

<title>修改内容</title>
</head>
<body>
<div class="pd-20">
	<form action="/baby/infos/updateInformation" method="post" class="form form-horizontal form-ueditor" id="form"  enctype="multipart/form-data">
		<div class="row cl">
			<label class="form-label col-1"><span class="c-red">*</span>分类名称：</label>
			<div class="formControls col-2"> <span class="select-box">
				<select name="type" id="type" class="select">
				
					<option value="2">赴美生子 流程</option>
					<option value="3">赴美生子 资讯</option>
					<option value="4">孕前服务 保险服务</option>					
					<option value="9">回国服务 美宝教育基金</option>
					<option value="10">回国服务 入学指南</option>
					<option value="11">海外医疗 美国试管</option>
					<option value="12">海外医疗 泰国试管</option>
					<option value="16">孕前服务 行前服务</option>
				</select>
				</span> </div>
		</div>

		<div class="row cl">
			<label class="form-label col-1"><span class="c-red">*</span>标题内容：</label>
			<div class="formControls col-3">
				<input type="text" class="input-text" value="" placeholder="" id="title" name="title">
        <input type="hidden" class="input-text" value="" placeholder="" id="titleid" name="sid">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-1">信息内容：</label>
			<div class="formControls col-10"> 
				<script id="editor" type="text/plain" style="width:100%;height:600px;" name="details"></script> 
			</div>
		</div>

		<div class="row cl">
			<div class="col-10 col-offset-1">
				<input type="submit" class="btn btn-primary radius"  name="submit" value="添 加" class="submit" />
			</div>
		</div>
	</form>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script> 
<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script src="js/jquery-form.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.validate.min.js" ></script>
<script type="text/javascript" src="js/messages_zh.min.js" ></script>
<script type="text/javascript" src="js/rule.js" ></script>

<script type="text/javascript">
var ue = UE.getEditor('editor');

$(document).ready(function(){
    $('#form').ajaxForm(function(data){

        //alert(data);//弹出ajax请求后的回调结果，data回调数据  onclick="sub()"
        if(data.code =="200" ){ 
         alert(data.message); 
         console.log(data); 
         var type = $('.select').val();
         if(type == 1){
              window.location.href='child-list.html';
             }else if(type == 2){
              window.location.href='votes-list.html';
             }else if(type ==3){
              window.location.href='news-list.html';
             }else if(type ==4){
              window.location.href='insur-list.html';
             }else if(type ==5){
              window.location.href='doctor-list.html';
             }else if(type ==6){
              window.location.href = 'check-list.html';
             }else if(type ==7){
              window.location.href = 'rush-list.html';
             }else if(type ==8){
              window.location.href='advice-list.html';
             }else if(type ==9){
              window.location.href='usa2-list.html';
             }else if(type ==10){
              window.location.href = 'school-list.html';
             }else if(type ==11){
              window.location.href = 'usa3-list.html'; 
             }else if(type ==12){
              window.location.href = 'thai-list.html'; 
          	 } else if(type ==13){
              window.location.href = 'baby-photo-list.html'; 
             } else if(type ==14){
              window.location.href = 'passport-travel-list.html'; 
             }else if(type ==16){
              window.location.href = 'tour_list.html'; 
             } 
         }else{  
            alert(data.message); 
            console.log(data);  
         }  
    });
});


 function getQueryString(name) {
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return unescape(r[2]); return null;
    }

  var sid = getQueryString("sid");

  //请求数据
  $.ajax({  
    url:'/baby/infos/getInformation',// 跳转到 action  
    data:{sid:sid},  
    type:'post',  
    cache:false,  
    dataType:'json',  
    success:function(data) { 
        if(data.code =="200" ){
        var data = data.data;
        console.log(data);
        $("#title").val(data.title);
        $("#titleid").val(data.sid);
  		var content = data.details;
        //判断ueditor 编辑器是否创建成功
        ue.addListener("ready", function () {
        	// editor准备好之后才可以使用
       		ue.setContent(content);
        });
        var type = data.type;
		$("#type option[value='"+type+"']").attr("selected",true);

       }else{
          alert(data.message);
        }
      }, 
      error : function() {      
        alert("异常！");  
    }  
  });


</script>
</body>
</html>
